package com.neusoft.dibuy.myarray;



import java.util.ArrayList;
import java.util.List;

public class RadixSort {
    public static void main(String[] args) {
        int[] arr = {26,3,49,556,81,9,863,0};
        List<Integer> [] bs = new   ArrayList [8];
        for (int i = 0; i <bs.length ; i++) {
            bs[i] = new ArrayList<>();
        }
        for (int i = 0; i < arr.length; i++) {
            int data =  arr[i];
            int index = data  & 0x07;
            bs[index].add(data);
        }

        List<Integer> [] bs1 = new   ArrayList [8];
        int xyz = 0 ;
        bs1[xyz] = new ArrayList<>();

        {
            xyz++;
            bs1[xyz] = new ArrayList<>();
        }

        for (int i = 0; i <bs1.length ; i++) {
            bs1[i] = new ArrayList<>();
        }

        for (int i = 0; i < bs.length; i++) {
            List  list  =  bs[i];
            for (int j = 0; j < list.size(); j++) {
                 int   data =  Integer.valueOf(  list.get(j).toString());
                 int index = data   & 0x38;
                 bs1[index].add(data);
            }

        }

        List<Integer> [] bs2 = new   ArrayList [8];
        for (int i = 0; i <bs2.length ; i++) {
            bs2[i] = new ArrayList<>();
        }

        for (int i = 0; i < bs1.length; i++) {
            List  list  =  bs1[i];
            for (int j = 0; j < list.size(); j++) {
                int   data =  Integer.valueOf(  list.get(j).toString());
                int index = data   & 0x38;
                bs2[index].add(data);
            }

        }




    }
}
